% latex template author: Søren Schaffstein
% let compiler know which file is the root file
% !TEX root = indoctrinatr-technical-documentation.tex

\chapter{Template Structure}


\section{Files in Template}
\dirtree{%
	.1 /.
	<% list_of_files.each do |item| %>
	<%= item.to_latex %>
	<% end %>
}

<% @files.each do |file| %>
\section{<%= file.name.to_latex -%>}

\begin{lstlisting}<%="[language=#{file.language}]" unless file.language == 'unspecified' %>
<%= file.content.gsub('\end{lstlisting}', '\end{lstlisting}'.to_latex) %><%# this escaping is important, so that lstlisting does not break. \begin lstlisting is ignored %>
\end{lstlisting}

<% end %>

\begin{landscape}
  \chapter{Variables}

  \begin{longtabu}{ l l X l X }
    \tabletoprule
    \textbf{Variable} & \textbf{Presentation} & \textbf{Default Value} & \textbf{Required} & \textbf{Description} \\
    \tabletoprule
    \endhead
    <% @attributes.each do |attribute| %>
      \texttt{<%= attribute['name'].to_latex -%>}
      & <%= attribute['presentation'].to_latex if attribute['presentation'] -%>
      & <%= attribute['default_value'].to_latex -%>
      & <%= 'true' if attribute['required'] == 'true' -%> <%# empty if false or not set. Wish by Søren for better readability-%>
      & <%= attribute['description'].to_latex if attribute['description'] -%>\\ <%# if condition to ignore errors on empty description field -%>
    <% end %>
  \end{longtabu}
\end{landscape}
